/* -----------------------------------------------------------
 * Author: Marie Caswell
 * Testing Function: drawCard()

 * Description: Check for correct drawCard() behavior.  If draw
 * deck has one or more cards, player hand should increase by 1.
 * If draw deck is empty, the discard deck should become the new 
 * draw deck, and player hand should increase by 1.
 -----------------------------------------------------------*/

#include "dominion.h"
#include "dominion_helpers.h"
#include <string.h>
#include <stdio.h>
#include <assert.h>
#include "rngs.h"

// set NOISY_TEST to 0 to remove printfs from output
#define NOISY_TEST 1

int main() {

	int seed = 1000;
    int numPlayer = 2;
    int k[10] = {adventurer, council_room, feast, gardens, mine, remodel, smithy, village, baron, great_hall};
    struct gameState G;

    memset(&G, 23, sizeof(struct gameState));   // clear the game state
    initializeGame(numPlayer, k, seed, &G); // initialize a new game

    printf("\nPre-draw hand count (Player 1): %d\n", G.handCount[0]); //check player 1 deck count

    drawCard(0, &G); //have player 1 draw a card
  
  	printf("Post-draw hand count (Player 1): %d\n", G.handCount[0]); //check player 1 deck count

  	assert(G.handCount[0] == 6); //confirm that player 1 hand count is correct after draw

  	G.deckCount[0] = 0; //force deck count to zero
  	G.discardCount[0] = 5; //force discard pile to 5

  	printf("Pre-draw deck count (Player 1): %d\n", G.deckCount[0]);

    drawCard(0, &G); //have player 1 draw a card

    printf("Post-draw deck count (Player 1): %d\n", G.deckCount[0]);

    assert(G.deckCount[0] == 4); //discard pile became new deck, player drew card, 4 is expected value

    assert(G.handCount[0] == 7); //confirm that player 1 hand count is correct after second draw

    printf("\nTests passed.\n");

return 0;

} 
